class Solution(object):
    def goodDaysToRobBank(self, security, time):
        n = len(security)
        pre = [0] * n
        suff = [0] * n
        for i in range(1, n):
            if security[i] <= security[i - 1]:
                pre[i] = pre[i - 1] + 1
            if security[n - 1 - i] <= security[n - i]:
                suff[n - 1 - i] = suff[n - i] + 1
        ans = []
        for i in range(n):
            if pre[i] >= time and suff[i] >= time:
                ans.append(i)
        return ans

data = Solution()
security = [5,3,3,3,5,6,2]
time = 2
print(data.goodDaysToRobBank(security, time))